]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dialogs: Hide caps lock warning if password entry is hidden
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 30 Jan 2020 10:27:25 +0000 (11:27 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 1 Feb 2020 07:08:33 +0000 (08:08 +0100)
If all password entries in dialogs are hidden, there is either an entry
that has visible characters or no entry at all. That means we don't have
to show the caps lock warning at all, so hide it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/942

js/ui/components/keyring.js
js/ui/components/polkitAgent.js

index 46c61ace047269501eb876842b6cf93efb070be2..c0191fbba907c8c14d21c42180e1cb4af19bb5d9 100644 (file)
@@ -59,6 +59,12 @@ class KeyringDialog extends ModalDialog.ModalDialog {
         let warningBox = new St.BoxLayout({ vertical: true });
 
         let capsLockWarning = new ShellEntry.CapsLockWarning();
+        let syncCapsLockWarningVisibility = () => {
+            capsLockWarning.visible =
+                this.prompt.password_visible || this.prompt.confirm_visible;
+        };
+        this.prompt.connect('notify::password-visible', syncCapsLockWarningVisibility);
+        this.prompt.connect('notify::confirm-visible', syncCapsLockWarningVisibility);
         warningBox.add_child(capsLockWarning);
 
         let warning = new St.Label({ style_class: 'prompt-dialog-error-label' });
index 2e154ff99a1d4ede3cc0cba580281b2948ba01c2..4228cac4b8e921b1e7ab824e211e31ba04935f56 100644 (file)
@@ -103,6 +103,9 @@ var AuthenticationDialog = GObject.registerClass({
         let warningBox = new St.BoxLayout({ vertical: true });
 
         let capsLockWarning = new ShellEntry.CapsLockWarning();
+        this._passwordEntry.bind_property('visible',
+            capsLockWarning, 'visible',
+            GObject.BindingFlags.SYNC_CREATE);
         warningBox.add_child(capsLockWarning);
 
         this._errorMessageLabel = new St.Label({